<template>
  <div class="category" @click="getCategoryDiscuss">
    <span>{{ classic.name }}</span>
    <i class="iconfont icon-xiangyou1"></i>
  </div>
</template>

<script>
export default {
  props: {
    classic: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      categoryTimer: null,
    };
  },

  mounted() {},

  methods: {
    //用于获取当前分类的讨论集合
    getCategoryDiscuss() {
      if (this.categoryTimer) {
        clearTimeout(this.categoryTimer);
      }
      this.categoryTimer = setTimeout(() => {
        this.$emit("getCategoryDiscuss", this.classic);
      }, 300);
    },
  },
};
</script>

<style lang="less" scoped>
.category {
  display: flex;
  justify-content: space-between;
  align-items: center;

  span {
    height: 30px;
    font-size: 14px;
    padding: 0px 10px;
    margin-bottom: 5px;
    line-height: 250%;
  }
}
</style>
